//! # math
//! 
//! This is a model related to math.
 
/// Add two numbers
/// 
/// # Example
/// ```
/// use tfc_toolbox_rs as tfc;
/// let result = tfc::math::add(2, 2);
/// assert_eq!(result, 4);
/// ```
pub fn add(num1: i32, num2: i32) -> i32 {
    num1 + num2
}

/// Subtracting two numbers
/// 
/// # Example
/// ```
/// use tfc_toolbox_rs as tfc;
/// let result = tfc::math::sub(3, 2);
/// assert_eq!(result, 1);
/// ```
pub fn sub(num1: i32, num2: i32) -> i32 {
    num1 - num2
}

/// Fibonacci
/// 
/// You can use it to generate a fibonacci number.
/// 
/// # Example
/// ```
/// use tfc_toolbox_rs as tfc;
/// let result = tfc::math::fibonacci(10);
/// assert_eq!(result, 55);
/// ```
pub fn fibonacci(n: u32) -> u64 {
    if n == 0 {
        return 0;
    }

    let mut a = 0;
    let mut b = 1;

    for _ in 1..n {
        let c = a + b;
        a = b;
        b = c;
    }

    b
}